libxl: check that device model binary is executable.
authorIan Campbell <ian.campbell@citrix.com>
Tue, 24 May 2011 14:15:27 +0000 (15:15 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 24 May 2011 14:15:27 +0000 (15:15 +0100)
This causes us to fail more quickly in more obvious failure case of not
having the right binary installed.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_dm.c

index 47a51c870855525b609652dac64f4c907608d1ed..b31ce859e8e2df3c0a2325bfb33a51ac14665a80 100644 (file)
@@ -762,7 +762,12 @@ int libxl__create_device_model(libxl__gc *gc,
         rc = ERROR_FAIL;
         goto out;
     }
-
+    if (access(dm, X_OK) < 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "device model %s is not executable", dm);
+        rc = ERROR_FAIL;
+        goto out;
+    }
     args = libxl__build_device_model_args(gc, dm, info, disks, num_disks,
                                           vifs, num_vifs);
     if (!args) {